package no.ntnu.fp.model;

import java.util.Calendar;

public class CalendarHelper {
	private String monthString;
	private String dayString;
	
	private Calendar cal;
	private int day;
	private int week;
	private int month;
	private int year;
	private int dow;
	private int dom;
	private int doy;
	
	public CalendarHelper(){
		cal = Calendar.getInstance();
		day = cal.get(Calendar.DATE);
		week = cal.get(Calendar.WEEK_OF_YEAR);
		month = cal.get(Calendar.MONTH) + 1;
		year = cal.get(Calendar.YEAR);
		dow = cal.get(Calendar.DAY_OF_WEEK);
		dom = cal.get(Calendar.DAY_OF_MONTH);
		doy = cal.get(Calendar.DAY_OF_YEAR);
		
	}
	

	
	public String getDate(){
		String date = day+"."+month+"."+year;
		return date;
	}
	
	public String[] getWholeWeek(){
		String[] array = new String[7];
		
		for (int i = 0; i < array.length; i++) {
			array[i] = getDayOfWeek(dow+i);
		}
		return array;
	}

	
	private String getMonth(){
		switch(month){
		case 1:  monthString = "Januar"; 	break;
		case 2:  monthString = "Februar";	break;
		case 3:  monthString = "Mars";		break;
		case 4:  monthString = "April";		break;
		case 5:  monthString = "Mai";		break;
		case 6:  monthString = "Juni";		break;
		case 7:  monthString = "Juli";		break;
		case 8:  monthString = "August"; 	break;
		case 9:  monthString = "September";	break;
		case 10: monthString = "Oktober";	break;
		case 11: monthString = "November";	break;
		case 12: monthString = "Desember";	break;
		default: monthString = "Invalid";	break;
		}
		return monthString;
	}
	
	private String getDayOfWeek(int gdow){
		switch(gdow){
		case 1: dayString = "Mandag";	break;
		case 2: dayString = "Tirsdag";	break;
		case 3: dayString = "Onsdag";	break;
		case 4: dayString = "Torsdag";	break;
		case 5: dayString = "Fredag";	break;
		case 6: dayString = "Lørdag";	break;
		case 7: dayString = "Søndag";	break;
		default: dayString = "Invalid";	break;
		}
		return dayString;
		
	}
	
	 


}
